package cn.demengsite.dao;

import cn.demengsite.model.Product;
import cn.demengsite.model.ProductImageAttr;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper
public interface ProductDAO {

    Product getProductByBarCode(@Param("barCode") String barCode);

    List<Product> getProductByProductId(@Param("productId") String productId);


    int updateProductNum(@Param("barCode") String barCode, @Param("productNum") Integer productNum);

    List<Product> getProductByPagination();

    List<Product> getAllProduct();

    List<Product> getAllProductGroupByProductId();

    int insertProduct(Product product);

    int updateProductByBarCode(Product product);

    int updateProductByProductId(Product product);

    int updateProductImage(ProductImageAttr imageAttr);

    int newProductImage(ProductImageAttr imageAttr);

    List<ProductImageAttr> getProductImageByProductId(@Param("productId") String productId);

    int updateProductSalePriceByDiscount(@Param("barCode")String barCode, @Param("discount") double discount);

    int deleteProductImageById(@Param("id") String id);

}
